<html> <!-- urlget.html -->
  <head>
    <title>AJAX Example</title>
  </head>
  <body style='text-align:center'>
    <h1>Loading a web page into a DIV</h1>
    <div id='info'>This sentence will be replaced</div>
  
    <script>
      nocache = "&nocache=" + Math.random() * 1000000
      request = new ajaxRequest()
      request.open("GET", "urlget.php?url=amazon.com/gp/aw" + nocache, true)
        
      request.onreadystatechange = function()
      {
        if (this.readyState == 4)
        {
          if (this.status == 200)
          {
            if (this.responseText != null)
            {
              document.getElementById('info').innerHTML =
                this.responseText
            }
            else alert("Ajax error: No data received")
          }
          else alert( "Ajax error: " + this.statusText)
        }
      }
      
      request.send(null)
      
      function ajaxRequest()
      {
        window.XMLHttpRequest =
        XMLHttpRequest                     ||
        ActiveXObject('Msxml2.XMLHTTP')    ||
        ActiveXObject('Microsoft.XMLHTTP')

        return new XMLHttpRequest()
      }
    </script>
  </body>
</html>
